#ifndef TYPEDEF_H_INCLUDED
#define TYPEDEF_H_INCLUDED

#include <stdint.h>
/**
 * BMP 文件结构
 */
typedef uint16_t WORD;
typedef uint32_t DWORD;
typedef uint64_t LONG;
typedef uint8_t BYTE;

/**
 * 文件头
 */
typedef struct tagBITMAPFILEHEADER {
  WORD bfType;
  DWORD bfSize;
  WORD bfReserved1;
  WORD bfReserved2;
  DWORD bfOffBits;
} BITMAPFILEHEADER;

/**
 * 信息头
 */
typedef struct tagBITMAPINFOHEADER {
  DWORD biSize;
  LONG biWidth;
  LONG biHeight;
  WORD biPlanes;
  WORD biBitCount;
  DWORD biCompression;
  DWORD biSizeImage;
  LONG biXPelsPerMeter;
  LONG biYPelsPerMeter;
  DWORD biClrUsed;
  DWORD biClrImportant;
} BITMAPINFOHEADER;

/**
 * 调色板
 */
typedef struct tagRGBQUAD {
  BYTE rgbBlue;
  BYTE rgbGreen;
  BYTE rgbRed;
  BYTE rgbReserved;
} RGBQUAD;

/**
 * 定义图像信息
 */
typedef struct tagBITMAPINFO {
  BITMAPFILEHEADER bmiHeader;
  RGBQUAD bmiColors[1];
} BITMAPINFO;

/**
 * 定义位图图像
 */
typedef struct _Bitmap {
  BITMAPFILEHEADER bmfh;
  BITMAPINFOHEADER bmih;
  int width;
  int height;
  int bitCount;
  int imageSize;
  BYTE *imageData;
  int widthStep;
} Bitmap;

#endif